/**
 * @param {number[]} nums
 * @return {number}
 */
var findRepeatNumber = function(nums) {
    let map = new Map()
    for (let i = 0; i< nums.length; i++) {
        let count = map.get(nums[i])
        if (map.has(nums[i])) {
            map.set(nums[i], count +1)
        }else {
            map.set(nums[i], 1)
        }
    }
    // return map
    for (let [key,value] of map.entries()) {
        if ( value!= 1) {

            return key;
        }
    }
};
var findRepeatNumber = function(nums) {
    let arr = nums.sort((a, b) => {return a - b})
    for (let i = 0; i< arr.length; i++) {
        if (arr[i] == arr[i+1]) {
            return arr[i]
        }
    }

};
let nums = [2, 3, 1, 0, 2, 5, 3]
console.log(findRepeatNumber(nums))